package com.gaohe.controller;

import com.gaohe.common.CodeUtils;
import com.gaohe.common.Result;
import com.gaohe.pojo.VO.LoginMemberVo;
import com.gaohe.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 会员登录
     * @param loginMemberVo
     * @return
     */
    @PostMapping("/loginMember")
    public Result login(@RequestBody LoginMemberVo loginMemberVo){
        log.info("/user:login,{}",loginMemberVo);
        return userService.login(loginMemberVo);
    }
    /**
     * 获取验证码
     * @param loginMemberVo
     * @return
     */
    @PostMapping("/sendMsg")
    public Result getCode(@RequestBody LoginMemberVo loginMemberVo){
        return userService.getCode(loginMemberVo);
    }
}
